Tomáš Pospíšek's Notizblock

How to add badblocks to initramfs

The following works under Debian buster and probably will work under older and newer Debian releases and under Ubuntu. Maybe it will also work on other Linux distributions:

$ cat /etc/initramfs-tools/hooks/copy_badblocks
#!/bin/sh
PREREQ=""
prereqs()
{
     echo "$PREREQ"
}

case $1 in
prereqs)
     prereqs
     exit 0
     ;;
esac

. /usr/share/initramfs-tools/hook-functions
# Begin real processing below this line

copy_exec /sbin/badblocks /sbin
# update-initramfs -u

Tomáš Pospíšek, 2019-03-04

Articles